package com.dao;

import com.model.PermissionSysUserRole;
import com.vo.PermissionRoleVO;
import com.vo.PermissionSysUserRoleVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PermissionSysUserRoleMapper {
    int deleteByPrimaryKey(Long id);
    @Delete("DELETE FROM permission_sys_user_role WHERE ROLE_ID =#{roleId} ")
    int deleteByRoleId(@Param("roleId")long roleId);

    int insert(PermissionSysUserRole record);

    int insertSelective(PermissionSysUserRole record);

    PermissionSysUserRole selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(PermissionSysUserRole record);

    int updateByPrimaryKey(PermissionSysUserRole record);

    @Select("DELETE FROM permission_sys_user_role WHERE USER_ID=#{userId} ")
    void deleteByAccountId(@Param("userId") Long userId);


    @Select("SELECT DISTINCT ROLE_ID  FROM permission_sys_user_role WHERE USER_ID=#{userId} ")
    List<Long> selectRoleIdListByAccountId(@Param("userId") Long userId);

    List<PermissionRoleVO> selectRoleListByUserId(@Param("userId")Long userId);



}